<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/3/16
 * Time: 19:23
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Controllers\BaseController;
use App\Http\Logics\MiniProgram\TagLogic;
use App\Http\Traits\TagTrait;

class TagController extends BaseController
{
    use TagTrait;

    /**
     * @SWG\Get(
     *     path="/tag/list",
     *     tags={"Tag"},
     *     description="获取分类标签列表",
     *     operationId="getTagList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥，并且通过loginSession获取合作者信息",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="category_id",
     *         in="query",
     *         description="分类ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getTagList()
    {
        $category_id = $this->category_id;
        $data = [
            'category_id' => $category_id
        ];
        $response = TagLogic::getTagList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/tag/brotherList",
     *     tags={"Tag"},
     *     description="获取某个标签的兄弟标签列表",
     *     operationId="getBrotherTagList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="tag_id",
     *         in="query",
     *         description="标签ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getBrotherTagList()
    {
        $tag_id = $this->tag_id;
        $data = [
            'tag_id' => $tag_id
        ];
        $response = TagLogic::getBrotherTagList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}